<?php
    include 'base.php';

    $pagenum = $_GET['page'];
    $totalpage = $_GET['limit'];

    $start = ($pagenum - 1) * $totalpage;

    $sql = "SELECT * FROM `goods` LIMIT $start, $totalpage";

    $res = $conn -> query($sql);

    $arr = array();

    $count = 0;

    while($row = mysqli_fetch_assoc($res)) {
        array_push($arr, $row);
        $count++;
    }

    echo json_encode(array(
        'code' => 0,
        'data' => $arr,
        'msg' => "获取数据成功",
        'count' => 20
    ));
?>